package com.example.demo.mapper;

import com.example.demo.mapper.entity.StudentTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Lucy
 * @create 2024-03-15 14:03
 */
@Mapper
@Repository
public interface CheckinAuditorMapper {
    @Select("SELECT * FROM student_task WHERE completion_status = 3")
    List<StudentTask> getPendingReviewStudentTasks();
    @Update("UPDATE checkin_image SET recognition_status = #{recognitionStatus} , checkin_status = #{checkinStatus} WHERE image_id = #{imageId}")
    void updateCheckinStatus(@Param("imageId")int imageId, @Param("recognitionStatus")int recognitionStatus, @Param("checkinStatus")int checkinStatus);
    @Update("UPDATE student_task SET completion_status = #{completionStatus} , completion_time = #{completionTimeStr} , review_status = #{reviewStatus} , user_id = #{userId} WHERE id = #{id}")
    void updateCompletionStatus(@Param("id")int id, @Param("completionStatus")int completionStatus, @Param("completionTimeStr")String completionTimeStr, @Param("reviewStatus")int reviewStatus, @Param("userId")int userId);
    @Update("UPDATE student_task SET reviewer_comments = #{reviewComments} WHERE id = #{id}")
    void updateReviewerComments(@Param("id")int id, @Param("reviewComments")String reviewComments);
}
